<!DOCTYPE html>
<!--
  Copyright 2018 Google Inc.

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
-->
<html>
  <head>
    <meta charset="utf-8">
    <title>Tab Scroller - Material Components Catalog</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/png" href="/images/logo_components_color_2x_web_48dp.png">
    <link rel="stylesheet" href="/assets/tab-scroller.css">
    <script src="/ready.js"></script>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  </head>

  <body class="mdc-typography">
    <header class="mdc-toolbar mdc-toolbar--fixed">
      <div class="mdc-toolbar__row">
        <section class="mdc-toolbar__section mdc-toolbar__section--align-start">
          <span class="catalog-back">
            <a href="/" class="mdc-toolbar__menu-icon"><i class="material-icons">&#xE5C4;</i></a>
          </span>
          <span class="mdc-toolbar__title catalog-title">Tab Scroller</span>
        </section>
      </div>
    </header>

    <main class="mdc-toolbar-fixed-adjust">
      <section class="hero">
        <div class="demo">
          <div class="mdc-tab-scroller demo-scroller">
            <div class="mdc-tab-scroller__scroll-area">
              <div class="mdc-tab-scroller__scroll-content demo-content">
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
                <span class="demo-cube"></span>
              </div>
            </div>
          </div>
          <form class="demo-controller">
            <div class="demo-controller-row">
              <label for="id0">Scroll to</label>
              <input id="id0" class="demo-scroll-value" type="number" name="scrollLeft" value="0">
              <button type="submit">Scroll</button>
            </div>
            <div class="demo-controller-row">
              <button type="button" class="demo-decrement">-50</button>
              <button type="button" class="demo-increment">+50</button>
            </div>
          </form>
        </div>
      </section>
      <section class="example">
        <div class="rtl-container">
          <h3>RTL</h3>
          <div>
            <input type="checkbox" id="rtl-checkbox"/>
            <label for="rtl-checkbox">Enabled</label>
          </div>
        </div>
      </section>
    </main>

    <script src="/assets/material-components-web.js" async></script>
    <script>
      demoReady(function() {

        function initDemo(demoRoot) {
          var scrollerEl = demoRoot.querySelector('.mdc-tab-scroller');
          window.scroller = new mdc.tabScroller.MDCTabScroller(scrollerEl);
          var controllerEl = demoRoot.querySelector('.demo-controller');
          var controllerScrollEl = controllerEl.querySelector('.demo-scroll-value');
          controllerEl.addEventListener('submit', function(evt) {
            evt.preventDefault();
            scroller.scrollTo(parseInt(controllerScrollEl.value));
          });

          var decrementButton = controllerEl.querySelector('.demo-decrement');
          decrementButton.addEventListener('click', function() {
            scroller.incrementScroll(-50);
          });

          var incrementButton = controllerEl.querySelector('.demo-increment');
          incrementButton.addEventListener('click', function() {
            scroller.incrementScroll(50);
          });
        }

        var demos = document.querySelectorAll('.demo');
        [].forEach.call(demos, initDemo);

        var rtlControls = document.getElementById('rtl-checkbox');
        rtlControls.addEventListener('change', function(event) {
          document.body.setAttribute('dir', event.currentTarget.checked ? 'rtl': 'ltr');
        });
      });
    </script>
  </body>
</html>
